package org.openrbac.rbac.service;

import com.baomidou.mybatisplus.extension.service.IService;
import org.openrbac.rbac.entity.Auth;
import org.openrbac.rbac.entity.Role;
import org.openrbac.rbac.entity.User;

import java.awt.image.BufferedImage;
import java.util.List;

/**
* @author bapie
* @description 针对表【user(系统用户)】的数据库操作Service
* @createDate 2024-04-03 15:37:15
*/
public interface UserService extends IService<User> {
    User getUser(String username);

    /**
     * 用户查询自己信息
     * @param user
     * @return
     */
    User getUser(User user, String token);

    /**
     * 根据用户名查询用户角色
     * @param username 用户名
     * @return 用户角色
     */
    List<Role> findRoles(String username);

    /**
     *
     * @param username
     * @return
     */
    List<Auth> findAuths(String username);

    /**
     *
     * @param username
     * @param roleIds
     * @return
     */
    boolean editRoles(String username, List<Long> roleIds);

    /**
     * 获取验证码
     * @return
     */
    BufferedImage getCaptcha();

    Boolean checkCaptcha(String captcha);
}
